#ifndef __STAT_MGR_H__
#define __STAT_MGR_H__

#include "utils/singleton.h"
#include "roles/player/playermgr.h"

struct StatData
{
	string strName;
	Color color;
	int bulletCount;

	int hittedCount[MAX_PLAYER_COUNT + 1];
};

typedef void (Delegater::*OnStatEndFunc)(int playerCount, StatData* pStatDatas);

class StatMgr : public Singleton<StatMgr>
{
public:
	StatMgr();
	~StatMgr();

	void Start();
	void Stop();

	void SetMinPlayerCount(int minPlayerCount);
	void AddPlayer(string strName, Color color);
	void AddBullet(int id);
	void Impacted(int id, int hittedId);

private:
	void OnAfterRender(float differTime);

public:
	Event<OnStatEndFunc> OnStatEnd;

private:
	int m_playerCount;
	int m_minPlayerCount;
	StatData m_statDatas[MAX_PLAYER_COUNT];

	float m_waitTime;
	bool m_bStartCalc;
};

#endif